// 桑基图
<template>
  <div class="threeBarChart"></div>
</template>

<script>
export default {
  name: '',
  data() {
    return {}
  },
  computed: {
    reset() {
      return this.$store.getters.sidebar.opened
    }
  },
  props: {
    xline: Array, // x轴名称列表
    yline: Array, // y轴数据
    config: Object // 参数配置
  },

  methods: {
    // 重新绘制图表
    forceRerender() {

    },
    setChart() {
      this.myChart = this.$echarts(this.$el);
      this.myChart.clear();
      this.myChart.resize()
      this.myChart.setOption(this.option);
    }
  },
  data() {
    return {
      show: true,
      myChart: undefined,
      option: {
        title: {
          text: 'Referer of a Website',
          subtext: 'Fake Data',
          left: 'center',
          show: false
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          left: '10%',
          top: "10%"
        },
        series: [
          {
            name: '排放类别分析',
            type: 'pie',
            radius: '50%',
            data: [
              {value: 1048, name: '范围一'},
              {value: 735, name: '范围二'},
              {value: 580, name: '范围三'},
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      }
    }
  },
  mounted() {
    this.setChart()
  },
  watch: {
    reset() {
      this.forceRerender()
    }
  }
}
</script>

<style lang="less" scoped>
.threeBarChart {
  height: 100%;
  width: 100%;
}
</style>
